#include "Object.h"
#include <math.h>
#include "VideoDriver.h"
Object::Object(void)
{
	this->m_PositionX = 0;
	this->m_PositionY = 0;
	this->m_Mass = 0;
	this->m_Type = NONE;
	this->m_Velocity = 0;
	
	this->m_isSelected = false;


}
Object::Object(float posX, float posY)
{
	this->m_PositionX = posX;
	this->m_PositionY = posY;
	this->m_Velocity = 0;
	this->m_Type = NONE;

	this->m_isSelected = false;

}
Object::~Object(void)
{
	//printf("Destructor Object!!\n");
}
void Object::SetPosition(float posX, float posY)
{
	this->m_PositionX = posX;
	this->m_PositionY = posY;
}
void Object::SetType(EObjectType m_Type)
{
	this->m_Type = m_Type;
}
EObjectType Object::GetType()
{
	return this->m_Type;
}
float Object::GetPosX()
{
	return this->m_PositionX;
}
float Object::GetPosY()
{
	return this->m_PositionY;
}
void Object::Update(float frameTime)
{
	//No Thing
}
void Object::SetSelect(bool m_isSelected)
{
	this->m_isSelected = m_isSelected;
}
bool Object::IsSelected()
{
	return this->m_isSelected;
}
void Object::SetVelocity(float m_Velocity)
{
	this->m_Velocity = m_Velocity;
}
void Object::SetVelocity(float m_VelocityX, float m_VelocityY)
{
	this->m_VelocityX = m_VelocityX;
	this->m_VelocityY = m_VelocityY;
}
void Object::AddMove(float m_deltaX, float m_deltaY)
{
	this->SetPosition(m_PositionX + m_deltaX, m_PositionY + m_deltaY);
}
void Object::MoveObjectAround(ObjectTouch* m_objectTouch)
{
	if(m_objectTouch->m_iStateTouch == TOUCH_MOVE)
	{
		
		int m_deltaX = m_objectTouch->m_iCurrentPosX - m_objectTouch->m_iPrePosX;
		int m_deltaY = m_objectTouch->m_iCurrentPosY - m_objectTouch->m_iPrePosY;
		AddMove(m_deltaX, m_deltaY);
	}
}
void Object::SetDestPosition(float m_DestPosX, float m_DestPosY)
{
	this->m_DestPositionX = m_DestPosX;
	this->m_DestPositionY = m_DestPosY;
}
void Object::DrawFullLine()
{
	VideoDriver::GetInstance()->DrawLine(m_PositionX, m_PositionY, m_PositionDestX, m_PositionDestY);
}
bool Object::CheckFlag(int flag, int mask)
{
	int result = 0;
	result = flag & mask;
	if(result != 0)
		return true;
	else return false;
}

